﻿using Nancy;
using Sys.API.DTO;

namespace Sys.API.Models
{
    public abstract class BaseModule : NancyModule
    {
        public BaseModule() :
            this(null)
        {
        }
         public BaseModule(string modulePath) :
            base(modulePath)
        {
       
         }
         /// <summary>
         /// 创建接口返回值的封装对象
         /// </summary>
         /// <param name="isSucess"></param>
         /// <param name="msg"></param>
         /// <param name="data"></param>
         /// <returns></returns>
         protected WebApiMsg<T> CreateWebApiMsg<T>(int status, string msg, T data)
         {
             return new WebApiMsg<T>()
             {
                 status = status,
                 message = msg,
                 data = data
             };
         }
         protected WebApiMsg CreateWebApiMsg(int status, string msg)
         {
             return new WebApiMsg()
             {
                 status = status,
                 message = msg
             };
         }
         protected AccessToken CreateAccess_Token(int status, string message, string access_token, int expires_in)
         {
             return new AccessToken()
             {
                 status = status,
                 access_token=access_token,
                 expires_in = expires_in,
                 message=message
             };
         }
         protected RefreshToken CreateRefresh_Token(int status, string message, string refresh_token)
         {
             return new RefreshToken()
             {
                 status = status,
                 refresh_token = refresh_token,
                 message=message
             };
         }
        
       
    }

   
}